home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
T-COMAL Today
/
(k)te.d64
/
src.compactor.14
< prev
next >
Wrap
Text File
|
2009-01-03
|
2KB
|
166 lines
; COMPILE/UNCOMPILE PICTURES
; BY DAVID STIDOLPH
;
; COMPRESSOR/DECOMPRESSOR
; FROM ARTICLE BY CHRIS ZAMARA
; TRANSACTOR -- VOLUME 6, ISSUE 4
; JAN. 1986
;
; CODE FOR COMAL, WRITTEN BY
; DAVID STIDOLPH
;
CHKIN = $FFC6
CHKOUT = $FFC9
CHRIN = $FFCF
CHROUT = $FFD2
CLRCHN = $FFCC
POINT = $A8
* = $C000
JMP LOADCD
JMP SAVECD
FILNUM .BYT 0
BYTE .BYT 0
OLDBYT .BYT 0
LAST .BYT 0
NUM .BYT 0
;
LOADCD LDX FILNUM
JSR CHKIN
LDA #$00
STA POINT
LDA #$E0
STA POINT+1
;
MAINLD JSR CHRIN
CMP #254
BNE NORMAL
JSR CHRIN
STA BYTE
JSR CHRIN
STA NUM
LDY #00
NEXT LDA BYTE
STA (POINT),Y
JSR INCRCV
DECNUM DEC NUM
BNE NEXT
JMP MAINLD
;
NORMAL LDY #00
STA (POINT),Y
JSR INCRCV
JMP MAINLD
;
INCRCV INC POINT
BNE NOTR1
INC POINT+1
NOTR1 LDA POINT+1
CMP #255
BNE NTENDR
LDA POINT
CMP #64
BNE NTENDR
PLA
PLA
JMP CLRCHN
NTENDR RTS
;
; COMPACTOR FOR COMAL 2.0
;
SAVECD LDX FILNUM
JSR CHKOUT
;
LDA #$00
STA POINT
LDA #$E0
STA POINT+1
;
SEI
LDA 1
AND #%11111101
STA 1
LDY #0
LDA (POINT),Y
STA BYTE
LDA 1
ORA #%00000010
STA 1
CLI
LDA #1
STA POINT
STA NUM
;
SAVEMN LDY #00
LDA BYTE
STA OLDBYT
SEI
LDA 1
AND #%11111101
STA 1
LDA (POINT),Y
STA BYTE
LDA 1
ORA #%00000010
STA 1
CLI
JSR PUTOUT
INC POINT
BNE NOTNOW
INC POINT+1
NOTNOW LDA POINT+1
CMP #$FF
BNE SAVEMN
LDA POINT
CMP #64
BNE SAVEMN
;
; END COMPRESS
;
JSR NMATCH
FINISH JMP CLRCHN
;
PUTOUT LDA BYTE
CMP OLDBYT
BNE NMATCH
INC NUM
BNE RETRN
DEC NUM
JMP NOT2
RETRN RTS
;
NMATCH LDA NUM
CMP #1
BNE NOT1
JSR SEND
RTS
;
NOT1 CMP #2
BNE NOT2
JSR SEND
JSR SEND
LDA #1
STA NUM
RTS
;
NOT2 LDA #254
JSR CHROUT
LDA OLDBYT
JSR CHROUT
LDA NUM
JSR CHROUT
LDA #1
STA NUM
RTS
;
SEND LDA OLDBYT
CMP #254
BNE NOT254
JSR CHROUT
LDA #254
JSR CHROUT
LDA #1
NOT254 JSR CHROUT
RTS
;
END .END